#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<cstring>
using namespace std;
const int N = 1010;
int primes[N];
bool st[N];
int n, k, T;
bool get_primes()
{
    int cnt = 0, res = 0;
    memset(st, false, n + 1);
    for (int i = 2; i <= n; i++)
    {
        if (!st[i]) primes[cnt++] = i;
        for (int j = 0; primes[j] <= n / i; j++)
        {
            st[primes[j] * i] = true;
            if (i % primes[j] == 0) break;
        }
    }
    for (int i = 0; i < cnt - 1; i++)
    {
        int num = primes[i] + primes[i + 1] + 1;
        if (num <= n && st[num] == false) res++;
    }
    return res >= k;
}
int main()
{
    cin >> T;
    while (T--)
    {
        cin >> n >> k;
        if (get_primes()) cout << "YES" << endl;
        else cout << "NO" << endl;
        //cout<<T<<endl;
    }
    return 0;
}